home *** CD-ROM | disk | FTP | other *** search
/ Mac-Source 1994 July / Mac-Source_July_1994.iso / C and C++ / Libraries / Effect library / Demo ƒ / Reversed wipes ƒ / Caste wipe down.c next >
Encoding:
C/C++ Source or Header  |  1994-01-11  |  2.3 KB  |  74 lines  |  [TEXT/KAHL]

  1. /**********************************************************************\
  2.  
  3. File:        Caste wipe down.c
  4.  
  5. Purpose:    Graphic effect from offscreen bitmap to main window (on
  6.             screen).  See comments below for more description.
  7.  
  8.  
  9. MSG Demo -- graphic effects demonstration program
  10. Copyright (C) 1992-4 Mark Pilgrim & Dave Blumenthal
  11.  
  12. This program is free software; you can redistribute it and/or modify
  13. it under the terms of the GNU General Public License as published by
  14. the Free Software Foundation; either version 2 of the License, or
  15. (at your option) any later version.
  16.  
  17. This program is distributed in the hope that it will be useful,
  18. but WITHOUT ANY WARRANTY; without even the implied warranty of
  19. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  20. GNU General Public License for more details.
  21.  
  22. You should have received a copy of the GNU General Public License
  23. along with this program in a file named "GNU General Public License".
  24. If not, write to the Free Software Foundation, 675 Mass Ave,
  25. Cambridge, MA 02139, USA.
  26.  
  27. \**********************************************************************/
  28.  
  29. #include "msg timing.h"
  30.  
  31. #define CorrectTime 1
  32. #define theWindowHeight (boundsRect.bottom-boundsRect.top)
  33. #define theWindowWidth (boundsRect.right-boundsRect.left)
  34.  
  35. pascal short CasteWipeDown(GrafPtr sourceGrafPtr, GrafPtr destGrafPtr, Rect boundsRect);
  36.  
  37. /* This takes a strip (starting with the bottommost strip, moving up) and copies
  38.    it into all the strips starting with the top and moving down until it's in
  39.    the right place. */
  40.    
  41. pascal short CasteWipeDown(GrafPtr sourceGrafPtr, GrafPtr destGrafPtr, Rect boundsRect)
  42. {
  43.     int                srcy, barpos;
  44.     Rect            src, dest;
  45.     Boolean            everyOther;
  46.     int                gap;
  47.     
  48.     gap=theWindowHeight/30;
  49.     everyOther=FALSE;
  50.     src.left = boundsRect.left;
  51.     src.right = boundsRect.right;
  52.     
  53.     for(srcy = boundsRect.bottom-gap; srcy >= boundsRect.top; srcy -= gap)
  54.     {
  55.         for(barpos = boundsRect.bottom; barpos >= boundsRect.top+gap; barpos -= gap);
  56.         for(; barpos <= srcy; barpos += gap)
  57.         {
  58.             StartTiming();
  59.             src.top = srcy;
  60.             src.bottom = srcy + gap;
  61.             dest = src;
  62.             dest.top = barpos;
  63.             dest.bottom = barpos + gap;
  64.             CopyBits(&(sourceGrafPtr->portBits), &(destGrafPtr->portBits),
  65.                     &src, &dest, 0, 0L);
  66.             if (everyOther)                      /* simulates time correction 0.5 */
  67.                 TimeCorrection(CorrectTime);
  68.             everyOther=!everyOther;
  69.         }
  70.     }
  71.     
  72.     return 0;
  73. }
  74.